const baseUrl = 'https://zoupk.top/api/'
const config = {
  locale: 'zh-CN', // en-US, zh-CN
  url: baseUrl,
  debug: {
    http: false // http request log
  },
  api: `${baseUrl}`,
  getUserInfo: function () {
    return JSON.parse(localStorage.getItem("userinfo"));
  },
  getUserRole: function () {
    return JSON.parse(localStorage.getItem("userrole"));
  },
  setUserRole: function (userinfo) {
    localStorage.setItem("userrole", JSON.stringify(userinfo));
  },
  setUserInfo: function (userinfo) {
    localStorage.setItem("userinfo", JSON.stringify(userinfo));
  },
  dateFormat:function resolvingDate(date){
//date是传入的时间
    let d = new Date(date);
    let month = (d.getMonth() + 1) < 10 ? '0'+(d.getMonth() + 1) : (d.getMonth() + 1);
    let day = d.getDate()<10 ? '0'+d.getDate() : d.getDate();
    let hours = d.getHours()<10 ? '0'+d.getHours() : d.getHours();
    let min = d.getMinutes()<10 ? '0'+d.getMinutes() : d.getMinutes();
    let sec = d.getSeconds()<10 ? '0'+d.getSeconds() : d.getSeconds();
    let times=d.getFullYear() + '-' + month + '-' + day + ' ' + hours + ':' + min + ':' + sec;
    return times
  }
}

export default config
